﻿<%@ Page Title="Function Management" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="FunctionManagement.aspx.cs" Inherits="PepsiCo.UI.FunctionManagement"
    EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $('#tbFunction tbody tr:odd, #tbRole tbody tr:odd').addClass('odd');
            $('#tbFunction tbody tr, #tbRole tbody tr').hover(function () {
                $(this).addClass('hover');
            }, function () {
                $(this).removeClass('hover');
            });
            $("#dialog-form").dialog({
                autoOpen: false,
                width: 450,
                modal: true,
                close: function () {
                }
            });
            $("#dialog-form").parent().appendTo($("form:first"))
            $(".ui-dialog-titlebar").remove();
        });

        function dialog() {
            $("#dialog-form").dialog({
                autoOpen: false,
                width: 450,
                modal: true,
            });
            $("#dialog-form").dialog('open');
            return false;
        }
    </script>
    <style type="text/css">
        .style1
        {
            width: 214px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-list">
                </div>
                <h1>
                    Function List</h1>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid">
                <table cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse"
                    id="tbFunction" class="table">
                    <thead style="height: 35px">
                        <tr>
                            <th style="width: 30px">
                                No
                            </th>
                            <th>
                                Function Name
                            </th>
                            <th>
                                Display Text
                            </th>
                            <th>
                                Description
                            </th>
                            <th style="width: 60px">
                                Action
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="rptObject" runat="server" OnItemCommand="rptObject_ItemCommand">
                            <ItemTemplate>
                                <tr>
                                    <td align="center">
                                        <%#(Container.ItemIndex +1) %>
                                    </td>
                                    <td>
                                        <%#Eval("FunctionName")%>
                                    </td>
                                    <td>
                                        <%#Eval("DisplayText")%>
                                    </td>
                                    <td>
                                        <%#Eval("Description")%>
                                    </td>
                                    <td style="text-align: center">
                                        <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/images/i_edit.gif" ToolTip="Edit"
                                            CommandArgument='<%#Eval("FunctionID")%>' CommandName="Edit" />
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div id="dialog-form" style="margin: auto; width: 480px;">
        <table border="1" cellpadding="2" cellspacing="2" style="border-collapse: collapse;
            width: 100%" id="tbRole">
            <thead style="background: #4A6C92; height: 35px">
                <tr>
                    <th style="width: 35px">
                        No
                    </th>
                    <th>
                        Role Name
                    </th>
                    <th style="width: 35px">
                        &nbsp;
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:Repeater ID="rptRole" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td align="center">
                                <%#(Container.ItemIndex +1) %>
                                <asp:HiddenField ID="hdfRole" runat="server" Value='<%#Eval("RoleId")%>' />
                            </td>
                            <td>
                                <%#Eval("RoleName")%>
                            </td>
                            <td align="center">
                                <asp:CheckBox ID="chkCheck" runat="server" Checked='<%#Eval("Checked")%>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
        </table>
        <div style="text-align: right; margin-top: 8px">
            <asp:Button ID="btnOK" runat="server" Text="Update" CssClass="btn" OnClick="btnOK_Click" />
            &nbsp;
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="btn" OnClientClick='$("#dialog-form").dialog("close"); return false;' />
        </div>
    </div>
    <input type="hidden" id="formId" value="FunctionManagement" />
</asp:Content>
